
<%@ page import="comptadub.Membre" import="comptadub.TypeMembre"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="admin" />
        <title><g:message code="membre.list.label" /></title>
    </head>

    <body>
        <div class="nav">
            <span class="menuButton"><g:link class="admin" controller="parametre" action="list"><g:message code="default.admin.label" /></g:link></span>
            <span class="menuButton"><g:link class="create" action="create"><g:message code="membre.new.label" /></g:link></span>
        </div>

        <div class="body">
            <h1>
              <g:message code="membre.list.label" />

              <g:if test="${session?.typeMembre == 'admin'}">
              <div class="titreButton">
                  <g:link action="export" params="${params + flash + [format:'excel', extension:'xls']}">
                      <img src="${createLinkTo(dir:'images/skin',file:'page_excel.png')}" alt="Exporter - Excel" />
                  </g:link>
                  <g:link action="export" params="${params + flash + [format:'excel', extension:'ods']}">
                      <img src="${createLinkTo(dir:'images/skin',file:'page_lightning.png')}" alt="Exporter - OpenOffice" />
                  </g:link>
              </div>
              </g:if>
            </h1>

            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>

            <div class="list">
                <table>
                    <thead>
                        <tr>                       
                            <g:sortableColumn property="id" title="${message(code: 'membre.id.label', default: 'Id')}" />                        
                            <g:sortableColumn property="nom" title="${message(code: 'membre.nom.label', default: 'Nom')}" />                        
                            <g:sortableColumn property="solde" title="${message(code: 'membre.solde.label', default: 'Solde')}" />
                            <g:sortableColumn property="email" title="${message(code: 'membre.email.label', default: 'Email')}" />
                            <g:sortableColumn property="type" title="${message(code: 'membre.email.type', default: 'Type')}" />
                            <g:sortableColumn property="virement" title="${message(code: 'membre.virement.type', default: 'Virement auto.')}" />
                            <th />
                        </tr>
                    </thead>
                    
                    <tbody>
                    <g:each in="${membreInstanceList}" status="i" var="membreInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">                        
                            <td>${fieldValue(bean: membreInstance, field: "id")}</td>                        
                            <td>${fieldValue(bean: membreInstance, field: "nom")}</td>                        
                            <td>${fieldValue(bean: membreInstance, field: "solde")}</td>
                            <td>${fieldValue(bean: membreInstance, field: "email")}</td>                        
                            <td>${membreInstance.type?.nom}</td>                        
                            <td>${membreInstance.virement}</td>
                            <td width="40px">
                                <g:link action="edit" id="${membreInstance.id}">
                                    <img src="${createLinkTo(dir:'images/skin',file:'pencil.png')}" alt="Modifier" />
                                </g:link>
                                <g:link action="delete" id="${membreInstance.id}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');">
                                    <img src="${createLinkTo(dir:'images/skin',file:'cross.png')}" alt="Supprimer" />
                                </g:link>
                            </td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>
            
            <div class="paginateButtons">
                <g:paginate total="${membreInstanceList.getTotalCount()}" params="${flash}" />
            </div>

            <h1><g:message code="default.filtre.label" /></h1>

            <g:form action="list" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="typemembre"><g:message code="typemembre.membre.label" default="TypeMembre" /></label>
                                </td>
                                <td valign="top" class="value">
                                    <g:select name="typemembre" noSelection="['':'Tous']" optionKey="id" optionValue="nom" value="${flash.typemembre}" from='${TypeMembre.list()}'></g:select>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>

                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Filtrer" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
